//
//  SearchTicketController.m
//  quickBatchManager
//
//  Created by 王定波 on 15/10/26.
//  Copyright © 2015年 jack. All rights reserved.
//

#import "SearchTicketController.h"

@interface SearchTicketController ()

@end

@implementation SearchTicketController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

-(void)initUI
{
    UIImage *image = _bg.image;
    image = [image stretchableImageWithLeftCapWidth:floorf(image.size.width/2) topCapHeight:floorf(image.size.height/2)];
    _bg.image=image;
    self.view.backgroundColor=[UIColor clearColor];
    [_closeBtn bk_whenTapped:^{
        [self dismissViewControllerAnimated:YES completion:nil];
    }];
    
    [_searchBtn bk_whenTapped:^{
        NSMutableDictionary *whereDict = [NSMutableDictionary dictionary];
        if([_modeNumberTextField.text isValid])
        {
            [whereDict setObject:_modeNumberTextField.text forKey:@"modelNo"];
        }
        if ([_clientNameTextField.text isValid])
        {
            [whereDict setObject:_clientNameTextField.text forKey:@"clientName"];
        }
        if ([_orderNumberTextField.text isValid])
        {
            [whereDict setObject:_orderNumberTextField.text forKey:@"orderNumber"];
        }
        if ([_numberTextField.text isValid])
        {
            [whereDict setObject:_numberTextField.text forKey:@"number"];
        }
        if ([_moneyTextField.text isValid])
        {
            [whereDict setObject:_moneyTextField.text forKey:@"money"];
        }
         [self dismissViewControllerAnimated:YES completion:nil];
        if(_delegate &&[_delegate respondsToSelector:@selector(searchResult:)])
        {
            NSLog(@"=======result");
            [_delegate searchResult:whereDict];
        }
    }];
    
    
    [_reSetBtn bk_whenTapped:^{
        
    }];
}

@end
